package org.JWCB.common.core.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;
import org.JWCB.common.core.constants.QuestionTagFieldName;

import java.util.HashMap;
import java.util.Map;

@Getter
@AllArgsConstructor
public enum QuestionTagEnums {
    IS_ARRAY(1001,(long) Math.pow(2,0),"数组", QuestionTagFieldName.TAG_INFO_01),
    IS_STRING(1002,(long)Math.pow(2,1),"字符串",QuestionTagFieldName.TAG_INFO_01),
    IS_LINK(1003,(long) Math.pow(2,2),"链表",QuestionTagFieldName.TAG_INFO_01),
    IS_STACK_OR_QUEUE(1004,(long) Math.pow(2,3),"栈/队列",QuestionTagFieldName.TAG_INFO_01),
    IS_TREE(1005,(long) Math.pow(2,4),"树结构",QuestionTagFieldName.TAG_INFO_01),
    IS_GRAPH(1006,(long) Math.pow(2,5),"图论",QuestionTagFieldName.TAG_INFO_01),


    IS_BASIC_ARITHMETIC(1100,(long) Math.pow(2,1),"基础算法",QuestionTagFieldName.TAG_INFO_02),
    IS_SORT_ARITHMETIC(1101,(long) Math.pow(2,2),"排序算法",QuestionTagFieldName.TAG_INFO_02),
    IS_SEARCH_ARITHMETIC(1102,(long) Math.pow(2,3),"查找算法",QuestionTagFieldName.TAG_INFO_02),
    IS_DOUBLE_POINTER(1103,(long) Math.pow(2,4),"双指针",QuestionTagFieldName.TAG_INFO_02),
    IS_SLIDING_WINDOW(1104,(long) Math.pow(2,5),"滑动窗口",QuestionTagFieldName.TAG_INFO_02),
    IS_DP(1105,(long) Math.pow(2,5),"动态规划",QuestionTagFieldName.TAG_INFO_02),
    IS_GREED(1106,(long) Math.pow(2,6),"贪心",QuestionTagFieldName.TAG_INFO_02),
    IS_MERGE(1109,(long) Math.pow(2,7),"分治",QuestionTagFieldName.TAG_INFO_02),

    ;
    int code;
    long tag;
    String desc;
    String fieldName;


    public static final Map<Integer, QuestionTagEnums> CODE_TO_ENUM_MAP = new HashMap<>();

    static {
        for (QuestionTagEnums e : values()) {
            CODE_TO_ENUM_MAP.put(e.code, e);
        }
    }
    public static QuestionTagEnums getByCode(int code) {
        return CODE_TO_ENUM_MAP.get(code);
    }
}
